package global

import (
	"gitee.com/cjianwen/go/demo/socks_v2/raft_demo/server/consts"
)

type serverInfo struct {
	ServerId        uint // 服务器 ID
	ServerCount     uint
	ServerCountHalf uint
}

func (si *serverInfo) GetListenPort() uint16 {
	return uint16(si.ServerId) + consts.ServerPort
}

func (si *serverInfo) Init() {
	si.ServerCountHalf = si.ServerCount / 2
}

var ServerInfo serverInfo

func CountIsAllOK(count uint32) bool {
	return count > uint32(ServerInfo.ServerCountHalf) //&& count >= uint32(NodeConns.GetConnCount())
}
